using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using DialectSoftware.Web.UI.CustomUserControls;
using DialectSoftware.Web.JsAPI;
using System.ComponentModel;

namespace Demo.UserControls
{
    [JsConverter(typeof(UserControlJsConverter))]
    [Designer(typeof(TemplatedDataBoundUserControlDesigner))]
    public partial class LightBox : TemplatedDataBoundUserControl
    {
       
        [ClientSideVariable("position")]
        public String position
        {
            get
            {
                return ViewState["position"] == null ? "absolute" : (String)ViewState["position"];
            }
            set
            {
                ViewState["position"] = value;
            }

        }

        [ClientSideVariable("display")]
        public String display
        {
            get
            {
                return ViewState["display"] == null ? "none" : (String)ViewState["display"];
            }
            set
            {
                ViewState["display"] = value;
            }

        }

        [ClientSideVariable("top")]
        public String top
        {
            get
            {
                return ViewState["top"] == null ? "25%" : (String)ViewState["top"];
            }
            set
            {
                ViewState["top"] = value;
            }

        }

        [ClientSideVariable("left")]
        public String left
        {
            get
            {
                return ViewState["left"] == null ? "25%" : (String)ViewState["left"];
            }
            set
            {
                ViewState["left"] = value;
            }

        }

        [ClientSideVariable("width")]
        public String width
        {
            get
            {
                return ViewState["width"] == null ? "50%" : (String)ViewState["width"];
            }
            set
            {
                ViewState["width"] = value;
            }

        }

        [ClientSideVariable("height")]
        public String height
        {
            get
            {
                return ViewState["height"] == null ? "50%" : (String)ViewState["height"];
            }
            set
            {
                ViewState["height"] = value;
            }

        }

        [ClientSideVariable("border")]
        public String border
        {
            get
            {
                return ViewState["border"] == null ? "16px solid orange" : (String)ViewState["border"];
            }
            set
            {
                ViewState["border"] = value;
            }

        }

        [ClientSideVariable("padding")]
        public String padding
        {
            get
            {
                return ViewState["padding"] == null ? "16px" : (String)ViewState["padding"];
            }
            set
            {
                ViewState["padding"] = value;
            }

        }

        [ClientSideVariable("backgroundColor")]
        public String backgroundColor
        {
            get
            {
                return ViewState["background-color"] == null ? "white" : (String)ViewState["background-color"];
            }
            set
            {
                ViewState["background-color"] = value;
            }

        }
        
        [ClientSideVariable("zIndex")]
        public String zIndex
        {
            get
            {
                return ViewState["z-index"] == null ? "1002" : (String)ViewState["z-index"];
            }
            set
            {
                ViewState["z-index"] = value;
            }

        }
        
        [ClientSideVariable("overflow")]
        public String overFlow
        {
            get
            {
                return ViewState["overflow"] == null ? "auto" : (String)ViewState["overflow"];
            }
            set
            {
                ViewState["overflow"] = value;
            }

        }

       
        /// <summary>
        /// 
        /// </summary>
        /// <param name="style">the style to change the objects appearance</param>
        /// <returns></returns>
        [JsFunction()]
        public JsOperation Show()
        {
            function f = new function();
            f.AddOperation(
                @"
                    $('" + this.ClientID  + @"').style.display='block';
                    $('fade').style.display='block'; 
                 "
             );
            return new JsOperation(this,f);
        }

        [JsFunction()]
        public JsOperation Hide()
        {
            function f = new function();
            f.AddOperation(
                 @"
                   $('" + this.ClientID + @"').style.display='none'; 
                   $('fade').style.display='none';
                 "
             );
            return new JsOperation(this,f);
        }


    }
}